package com.aggregate.pay.ebcpay.support.client;

import com.aggregate.pay.ebcpay.bean.SinglePayData;
import com.aggregate.pay.ebcpay.bean.SinglePayResult;
import com.aggregate.pay.ebcpay.support.AbstractClient;
import com.aggregate.pay.ebcpay.support.Merch;

/**
 * 单笔代付接口
 * @author Moyq5
 * @date 2019年3月14日
 */
public class SinglePay extends AbstractClient<SinglePayData, SinglePayResult> {

	public SinglePay(Merch merch) {
		super(merch);
	}

	@Override
	protected Class<SinglePayResult> resultClass() {
		return SinglePayResult.class;
	}

	@Override
	protected String serverPath() {
		return super.serverPath() + "/jspay/ptb";
	}

	@Override
	protected String signString(SinglePayData data) {
		return String.format("[idMerchant=%s&typeChannel=%s&version=%s&typeSign=%s&reqNo=%s&reqTime=%s"
				+ "&orderNumber=%s&dtPay=%s&receiverCardNo=%s&receiverName=%s&receiverType=%s"
				+ "&receiverCurrency=%s&bankName=%s&bankCode=%s&amount=%s]", 
				data.getIdMerchant(),
				data.getTypeChannel(),
				data.getVersion(),
				data.getTypeSign(),
				data.getReqNo(),
				data.getReqTime(),
				data.getOrderNumber(),
				data.getDtPay(),
				data.getReceiverCardNo(),
				data.getReceiverName(),
				data.getReceiverType(),
				data.getReceiverCurrency(),
				data.getBankName(),
				data.getBankCode(),
				data.getAmount());
		
	}

}
